<template>
  <div>
    <Banner
      :sightName="sightName"
      :bannerImg="bannerImg"
      :gallaryImgs="gallaryImgs"
    ></Banner>
    <Header></Header>
    <div class="content">
      <List :list="list"></List>
    </div>
  </div>
</template>

<script>
  import Banner from './components/Banner'
  import Header from './components/Header'
  import List from './components/List'
  import axios from 'axios'

  export default {
    name: "Detail",
    data() {
      return {
        sightName: '',
        bannerImg: '',
        gallaryImgs: [],
        list: []
      }
    },
    components: {
      Banner,
      Header,
      List
    },
    methods: {
      getDetailInfo() {
        axios.get('/static/mock/detail.json',{
          params:{
            id:this.$route.params.id
          }
        })
          .then(this.handleDetailInfo)
      },
      handleDetailInfo(res) {
        const data = res.data.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.list = data.categoryList
      }
    },
    mounted() {
      this.getDetailInfo()
    }
  }
</script>

<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
